package com.shj.em.base.exception;

/**
 * @author Shen Huang Jian
 * @date 2018/11/4
 */
public class BizException extends RuntimeException {

    /** Constructs a new business exception with the specified detail message.
     * The cause is not initialized, and may subsequently be initialized by a
     * call to {@link #initCause}.
     *
     * @param   bizCodeMsg  错误代码
     */
    public BizException(BizCodeMsg bizCodeMsg) {
        super(bizCodeMsg.getCode() + "-" + bizCodeMsg.getMsg());
    }

    /**
     * Constructs a new business exception with the specified detail message and
     * cause.  <p>Note that the detail message associated with
     * {@code cause} is <i>not</i> automatically incorporated in
     * this runtime exception's detail message.
     *
     * @param   bizCodeMsg  错误代码
     * @param  cause the cause (which is saved for later retrieval by the
     *         {@link #getCause()} method).  (A <tt>null</tt> value is
     *         permitted, and indicates that the cause is nonexistent or
     *         unknown.)
     */
    public BizException(BizCodeMsg bizCodeMsg, Throwable cause) {
        super(bizCodeMsg.getCode() + "-" + bizCodeMsg.getMsg(), cause);
    }

    public BizException(String msg){
        super(msg);
    }
}
